<template>
  <div>
    <h2>TsUser</h2>
    <p>name {{ name }}</p>
    <p>gender {{ gender }}</p>
    <p>phone {{ phone }}</p>
    <p>age {{ age }}</p>
    <p>allow {{ allow }}</p>
    <p>hobby {{ hobby }}</p>
    <p>info {{ info }}</p>
    <p>hide {{ hide }}</p>
    <p>cb {{ cb }}</p>
  </div>
</template>
<script>
// function(age=20,phone){}
export default {
  props: {
    gender: {
      required: true,
      default: '男',
      validator(value) {
        return ['男', '女'].includes(value);
      },
    },
    phone: {
      validator: function (value) {
        return /^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value);
      }
    },
    // name: String,
    name: {
      type: String,//[Number, String],
      required: true //必填
    },
    age: {
      type: Number,
      default: 20
    },
    allow: Boolean,
    hobby: Array,
    info: {
      type: Object,
      default: function () {
        return { a: 1 };
      }
    },
    hide: Symbol,
    cb: Function
  },
};
</script>
<style></style>